package com.atguigu.cloud.apis;

import com.atguigu.cloud.entities.PayDTO;
import com.atguigu.cloud.resp.ResultData;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @Description:
 * @author： yeswater
 * @create： 2024/5/26
 */

@FeignClient(value = "cloud-gateway")
//@FeignClient(value = "cloud-payment-service")
public interface PayFeignApi {
	
	/**
	 * 新增一条支付相关流水记录
	 * @param payDTO
	 * @return
	 */
	@PostMapping(value = "/pay/add")
	public ResultData addPay(@RequestBody PayDTO payDTO);
	
	/**
	 * 按照主键记录查询支付流水信息
	 * @param id
	 * @return
	 */
	@GetMapping(value = "/pay/get/{id}")
	public ResultData getPayInfo(@PathVariable("id") Integer id);
	
	/**
	 * openfeign天然支持负载均衡演示
	 * @return
	 */
	@GetMapping(value = "/pay/get/info")
	public String mylb();
	
	/**
	 * Resilience4j CircuitBreaker 的例子
	 * @param id
	 * @return
	 */
	@GetMapping(value = "/pay/circuit/{id}")
	public String myCircuit(@PathVariable("id") Integer id);
	
	/**
	 * Resilience4j Bulkhead 的例子
	 * @param id
	 * @return
	 */
	@GetMapping(value = "/pay/bulkhead/{id}")
	public String myBulkhead(@PathVariable("id") Integer id);
	
	/**
	 * Resilience4j Ratelimit 的例子
	 * @param id
	 * @return
	 */
	@GetMapping(value = "/pay/ratelimit/{id}")
	public String myRatelimit(@PathVariable("id") Integer id);
	
	/**
	 * Micrometer(Sleuth)进行链路监控的例子
	 * @param id
	 * @return
	 */
	@GetMapping(value = "/pay/micrometer/{id}")
	public String myMicrometer(@PathVariable("id") Integer id);
	
}
